package com.itbour.web.action.material;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts2.ServletActionContext;

import com.google.gson.Gson;
import com.itbour.com.page.Page;
import com.itbour.common.base.BaseAction;
import com.itbour.common.util.StringUtils;
import com.itbour.dto.com.UserInfoDto;
import com.itbour.dto.template.DocTypeDto;
import com.itbour.dto.template.EditorPageInfoDto;
import com.itbour.dto.template.TemplateInfoDto;
import com.itbour.dto.template.EgretDocInfoDto;
import com.itbour.dto.template.TmplPageInfoDto;
import com.itbour.dto.tg.KeywordInfoDto;
import com.itbour.dto.trade.TmplPriceInfoDto;
import com.itbour.service.material.TmplService;
import com.opensymphony.xwork2.ActionContext;

/**
 * copyright Itbour team 2015
 * 
 * @author xc
 */

public class GetTmplListWebAction extends BaseAction {

	private static final long serialVersionUID = 1L;

	private TmplService tmplService;
	private List<TemplateInfoDto> tmplDocList;
	private TemplateInfoDto tmplDocInfo;
	
	private String ids;// 删除/更新用id
	private String typeIds;// 模版类型id
	private List<String> tmplTypeInfo;
	private List<DocTypeDto> tpyeComboList;
	private String userId;
	
	private String findPubFlg;// 检索条件
	private String findTmplName;// 检索条件
	private String findTmplId;// 检索条件
	private String findUserId;// 检索条件
	private String findTmplType;// 检索条件
	private String findMstFlg;// 检索母版
	HashMap<String, Object> mapResult = new HashMap<String, Object>();// 检索结果
	
	private List<TemplateInfoDto> mstTmplList;// 母版列表(编辑器用)
	private List<TmplPageInfoDto> mstTmplPageList;// 母版页列表(编辑器用)
	
	private List<Object> keywordList;// 关键词
	
	private String egretJsonInfo;// Egret模版数据
	private String docId;// 模版id
	
	private String order;// 显示顺序
	private String vip;// vip模版
	
	private HashMap<String, Object> userDocMap = new HashMap<String, Object>();//用户文档
	private String findDocId;//搜索文档ID
	private String findMobile;//搜索手机号
	private String findUId;//通过用户id搜索ppt下的用户文档
	
	HashMap<String, Object> mapResultTmplPrice = new HashMap<String, Object>();// 模版价格检索结果
	private TmplPriceInfoDto tmplPriceInfo;
	

	public String getTmpl() throws Exception {

		HttpServletRequest request = ServletActionContext.getRequest();
		Map<String, Object> param = new HashMap<String, Object>();
		String id = request.getParameter("docId");
		if (StringUtils.isNotEmpty(id)) {
			param.put("tmpl_id", id);
		}

		tmplDocList = tmplService.selectTmplInfo(param);
		return SUCCESS;
	}
	
	// Egret用
	public String getTmpl2() throws Exception {

		HttpServletRequest request = ServletActionContext.getRequest();
		String id = request.getParameter("docId");
		if (StringUtils.isNotEmpty(id)) {
			// 用户信息
			Map<String, Object> session = ActionContext.getContext().getSession();
	    	UserInfoDto user = (UserInfoDto)session.get("user");
	    	
			// 检索条件
			Map<String, Object> param = new HashMap<String, Object>();
			param.put("tmpl_id", id);
			//param.put("user_id", user.getUser_id());
			// 获取document数据
			List<TemplateInfoDto> docList = tmplService.selectTmplInfo(param);
			if (docList != null && docList.size() > 0) {
				TemplateInfoDto docInfo = docList.get(0);
				// 获取pages数据
				List<EditorPageInfoDto> pagesInfo = new ArrayList<EditorPageInfoDto>();
				List<TmplPageInfoDto> pageList = tmplService.selectTmplPage(param);
				if (pageList != null && pageList.size() > 0) {
					String pages = "\"pages\":[";
					for (int i = 0; i < pageList.size(); i++) {
						if (i > 0) {
							pages += ",";
						}
						pages += pageList.get(i).getData();// Page数据（JSON字符串）
						
						EditorPageInfoDto epi = new EditorPageInfoDto();
						epi.setPage_id(pageList.get(i).getPage_id());// PageId
						epi.setBase_page_id(pageList.get(i).getBase_page_id());// 母版id
						epi.setPage_index(pageList.get(i).getPage_index());
						epi.setThumb(pageList.get(i).getThumb_s());// Page缩略图
						pagesInfo.add(epi);
					}
					pages += "]";
					
					// 将pages数据拼接到document数据中
					String newData = docInfo.getData().replace("\"pages\":[]", pages);
					docInfo.setData(newData);
					docInfo.setPagesInfo(pagesInfo);
				}
				
				tmplDocInfo = docInfo;
			}
		}
		
		return SUCCESS;
	}
	
	// Egret用
	public String getTmplPage() throws Exception {

		HttpServletRequest request = ServletActionContext.getRequest();
		String id = request.getParameter("docId");
		if (StringUtils.isNotEmpty(id)) {
			// 用户信息
			Map<String, Object> session = ActionContext.getContext().getSession();
	    	UserInfoDto user = (UserInfoDto)session.get("user");
	    	
			// 检索条件
			Map<String, Object> param = new HashMap<String, Object>();
			param.put("tmpl_id", id);
			//param.put("user_id", user.getUser_id());
			// 获取document数据
			List<TemplateInfoDto> docList = tmplService.selectTmplInfo(param);
			if (docList != null && docList.size() > 0) {
				TemplateInfoDto docInfo = docList.get(0);
				// 获取pages数据
				mstTmplPageList = tmplService.selectTmplPage(param);
			}
		}
		
		return SUCCESS;
	}
		
	// Egret用:获取母版列表
	public String getMstTmplLst() throws Exception {
		if (mstTmplList == null) {
			mstTmplList = new ArrayList<TemplateInfoDto>();
		} else {
			mstTmplList.clear();
		}
		
		// 用户信息
		Map<String, Object> session = ActionContext.getContext().getSession();
    	UserInfoDto user = (UserInfoDto)session.get("user");
		//if (user != null) 
		{
			HttpServletRequest request = ServletActionContext.getRequest();
			String type = request.getParameter("mstType");// TODO
	    	
			// 检索条件
			Map<String, Object> param = new HashMap<String, Object>();
			//param.put("tmpl_type", type);
			//param.put("user_id", user.getUser_id());
			//param.put("publish", 1);
			// 获取数据
			mstTmplList = tmplService.selectMstTmplLst(param);
		}
		
		return SUCCESS;
	}
	
	public String getTmplList() throws Exception {
		// 用户信息
		Map<String, Object> session = ActionContext.getContext().getSession();
    	UserInfoDto user = (UserInfoDto)session.get("user");
    	if(user!=null && user.getUser_id()!=null && user.getRole()!=null) {
    		HttpServletRequest request = ServletActionContext.getRequest();
    		String pageNumber = request.getParameter("page");
    		String pageSize = request.getParameter("rows");
    		Map<String, Object> param = new HashMap<String, Object>();
    		if (StringUtils.isNotBlank(findTmplType)) {
    			param.put("typeIds", StringUtils.listToString2(StringUtils.stringToList2(findTmplType)));
    		}
    		if (StringUtils.isNotBlank(findPubFlg)) {
    			param.put("publish", findPubFlg);
    		}
    		if (StringUtils.isNotEmpty(findTmplName)) {
    			param.put("tmpl_name", "%"+findTmplName+"%");
    		}
    		if (StringUtils.isNotEmpty(findTmplId)) {
    			param.put("tmpl_id", findTmplId);
    		}
    		if (StringUtils.isNotEmpty(findUserId)) {
    			param.put("user_id", findUserId);
    		}

    		// 默认只检索自己的文档([管理员,模版操作员]除外)
    		if(!user.isAdmin() && (user.getRole()&32)!=32) {
    			param.put("user_id", user.getUser_id());
    		}
    		
    		if (StringUtils.isEqual(findMstFlg, "1")) {
    			param.put("master", "1");// 检索母版
    		} else {
    			param.put("master", "0");// 检索模版
    		}
    		Page page = tmplService.pageQuery(param, Integer.parseInt(pageNumber),
    				Integer.parseInt(pageSize));
    		HashMap<String, Object> resMap = new HashMap<String, Object>();
    		resMap.put("total", page.getTotalCount());
    		resMap.put("rows", page.getResult());
    		//writeJSON(resMap);
    		mapResult = resMap;
    	} else {
    		mapResult.clear();
    	}

		return SUCCESS;
	}
	
	public void deleteTmpl() throws Exception {
		tmplService.deleteTmplInfo(ids);
		this.writeJSON("ok");
	}

	public void addTmpl() throws Exception {
		if (tmplDocInfo != null) {
			Map<String, Object> session = ActionContext.getContext().getSession();
	    	UserInfoDto user = (UserInfoDto)session.get("user");
	    	if (user != null) {
	    		tmplDocInfo.setUpdate_by(user.getUser_name());
	    		tmplDocInfo.setUser_id(user.getUser_id());
	    		tmplDocInfo.setUser_type(user.getUser_type());
	    	}
	    	
			tmplService.addTmplDoc(tmplDocInfo);
		}
		this.writeJSON("ok");
	}
	
	// Egret用
	public void addTmpl2() throws Exception {
		HashMap<String, Object> resMap = new HashMap<String, Object>();
		if (egretJsonInfo != null) {
			Gson gson = new Gson();
			EgretDocInfoDto egretInfo = gson.fromJson(egretJsonInfo, EgretDocInfoDto.class);
			if (egretInfo != null) {
				// 用户信息
				Map<String, Object> session = ActionContext.getContext().getSession();
		    	UserInfoDto user = (UserInfoDto)session.get("user");
		    	
				// 取参数:模版id/版本号/母版flg
				HttpServletRequest request = ServletActionContext.getRequest();
				String id = request.getParameter("docId");
				String ver = request.getParameter("verNo");
				//String name = request.getParameter("docNm");
				String mstId = request.getParameter("mstId");// 母版id
				
				// 模版id不为空:更新
				if (StringUtils.isNotBlank(id)) {
					
					if(!user.isSuperUser()){// 超级用户可修改
						// user_id, doc_id关联check
						Map<String, Object> chkParam = new HashMap<String, Object>();
						chkParam.put("tmpl_id", Long.valueOf(id.trim()));
						chkParam.put("user_id", user.getUser_id());
						chkParam.put("del_flg", 0);
						List<TemplateInfoDto> chkList = tmplService.selectTmplInfo(chkParam);
						if (chkList == null || chkList.size() == 0) {
							resMap.put("status", "ng");
				      		resMap.put("msg", "本文档禁止修改！");
				      		this.writeJSON(resMap);
							return;
						}
					}
					
					// 更新document数据
					Map<String, Object> param = new HashMap<String, Object>();
					param.put("tmpl_id", Long.valueOf(id.trim()));
					param.put("tmpl_name", egretInfo.getDocName());
					param.put("ver", Integer.valueOf(ver));
					param.put("data", egretInfo.getDocData());
					param.put("update_by", user.getUser_id().toString());
					tmplService.updateTmplDocById(param);
					
					// 先逻辑删除所有页
					tmplService.deleteTmplPage(param);
					
					// 再根据page_id更新/新规pages数据
					for (int i = 0; i < egretInfo.getPagesData().size(); i++) {
						Map<String, String> pageInfo = egretInfo.getPagesData().get(i);
						Long pageId = null;
						if (StringUtils.isNotBlank(pageInfo.get("page_id"))) {
							pageId = Long.valueOf(pageInfo.get("page_id"));
						}
						
						if (pageId != null && pageId > 0) {
							// 保持原page_id更新
							Map<String, Object> pageParam = new HashMap<String, Object>();
							pageParam.put("page_id", pageId);
							pageParam.put("page_index", Integer.valueOf(pageInfo.get("page_index")));
							pageParam.put("replaces", pageInfo.get("replaces"));
							pageParam.put("rep_hash_tag", pageInfo.get("rep_hash_tag"));// 切换模版用
							pageParam.put("data", pageInfo.get("pageData"));
							pageParam.put("thumb_s", "");// 更新为空，以便图像服务器重新生成
							pageParam.put("backup_flg", Integer.valueOf(pageInfo.get("backup_flg")));
							pageParam.put("update_by", user.getUser_id());
							pageParam.put("del_flg", 0);// 从删除状态恢复
							tmplService.updateTmplPageById(pageParam);
						} else {
							// 新规
							TmplPageInfoDto pageDto = new TmplPageInfoDto();
							pageDto.setTmpl_id(Long.valueOf(id.trim()));
							pageDto.setBase_page_id(Long.valueOf(pageInfo.get("base_page_id")));
							pageDto.setUpdate_by(user.getUser_id().toString());
							pageDto.setUser_type(user.getUser_type());
							// Thumb设空,由图像服务器生成
							pageDto.setThumb_s(null);
							pageDto.setPage_index( Integer.valueOf(pageInfo.get("page_index")) );
							pageDto.setReplaces( pageInfo.get("replaces") );
							pageDto.setRep_hash_tag( Long.valueOf(pageInfo.get("rep_hash_tag")) );// 切换模版用
							pageDto.setData( pageInfo.get("pageData") );
							pageDto.setBackup_flg( Integer.valueOf(pageInfo.get("backup_flg")) );
							tmplService.addTmplPage(pageDto);
						}
					}
					
				// 模版id为空:新规
				} else {
					// 新规document数据
					TemplateInfoDto docDto = new TemplateInfoDto();
					docDto.setUpdate_by(user.getUser_id().toString());
					docDto.setUser_id(user.getUser_id());
					docDto.setUser_type(user.getUser_type());
					if (StringUtils.isNotBlank(mstId) && Long.valueOf(mstId)>0L) {
						docDto.setMaster(0);// 普通模版
						docDto.setBase_tmpl_id(Long.valueOf(mstId));// 母版id
					} else {
						docDto.setMaster(1);// 母版Flag
						docDto.setBase_tmpl_id(null);
					}
					docDto.setData(egretInfo.getDocData());
					docDto.setTmpl_name(egretInfo.getDocName());
					docDto.setPublish(0);// 默认制作中
					docDto.setVer(Integer.valueOf(ver));
					tmplService.addTmplDoc(docDto);
					
					TemplateInfoDto latestDoc = tmplService.getLatestTmplDoc();
					id = latestDoc.getTmpl_id().toString();
					
					// 新规pages数据
					for (int i = 0; i < egretInfo.getPagesData().size(); i++) {
						Map<String, String> pageInfo = egretInfo.getPagesData().get(i);
						
						TmplPageInfoDto pageDto = new TmplPageInfoDto();
						pageDto.setTmpl_id(Long.valueOf(id.trim()));
						pageDto.setUpdate_by(user.getUser_id().toString());
						pageDto.setUser_type(user.getUser_type());
						// Thumb设空,由图像服务器生成
						pageDto.setThumb_s(null);
						if (0 == docDto.getMaster()) {// 普通模版
							// 母版页id
							pageDto.setBase_page_id(Long.valueOf(pageInfo.get("base_page_id")));
						} else {
							pageDto.setBase_page_id(null);
						}
						pageDto.setPage_index( Integer.valueOf(pageInfo.get("page_index")) );
						pageDto.setReplaces( pageInfo.get("replaces") );
						pageDto.setRep_hash_tag( Long.valueOf(pageInfo.get("rep_hash_tag")) );// 切换模版用
						pageDto.setData( pageInfo.get("pageData") );
						pageDto.setBackup_flg( Integer.valueOf(pageInfo.get("backup_flg")) );
						tmplService.addTmplPage(pageDto);
					}
				}
				
				// 检索pageIds
				Map<String, Object> param = new HashMap<String, Object>();
				param.put("tmpl_id", id);
				List<TmplPageInfoDto> pageList = tmplService.selectTmplPage(param);// 按page_index排序
				List<Long> pageIds = new ArrayList<Long>();
				if (pageList != null && pageList.size()>0){
					for (int n=0; n<pageList.size(); n++){
						pageIds.add(pageList.get(n).getPage_id());
					}
				}
				
				resMap.put("status", "ok");
	      		resMap.put("docId", id);
	      		resMap.put("pageIds",pageIds);
	      		this.writeJSON(resMap);
				return;
			}
		}

		resMap.put("status", "ng");
		this.writeJSON(resMap);
	}

	public void cancelPublish() throws Exception {
		if (StringUtils.isNotBlank(ids)) {
			Map<String, Object> session = ActionContext.getContext().getSession();
	    	UserInfoDto user = (UserInfoDto)session.get("user");
	    	
			Map<String, Object> param = new HashMap<String, Object>();
			param.put("publish", 0);
			param.put("ids", StringUtils.listToString2(StringUtils.stringToList2(ids)));
			param.put("update_by", user.getUser_name());
			tmplService.updateTmplDocById(param);
		}
		this.writeJSON("ok");
	}
	
	public void doPublish() throws Exception {
		if (StringUtils.isNotBlank(ids)) {// ids: ","连接
			List<Long> listId = StringUtils.stringToList2(ids);
			
			// check
			Map<String, Object> param = new HashMap<String, Object>();
			param.put("tmplIds", StringUtils.listToString2(listId));
			List<TmplPageInfoDto> lstPage = tmplService.selectTmplPage(param);
			if (lstPage != null && lstPage.size() > 0) {
				for (int i = 0; i < lstPage.size(); i++) {
					// 无预览图 不能发布
					if (StringUtils.isBlank(lstPage.get(i).getThumb_s())) {
						this.writeJSON("ng");
						return;
					}
				}
			}
			
			Map<String, Object> session = ActionContext.getContext().getSession();
	    	UserInfoDto user = (UserInfoDto)session.get("user");
	    	// update
			param.put("publish", 1);
			param.put("ids", StringUtils.listToString2(listId));
			param.put("update_by", user.getUser_name());
			tmplService.updateTmplDocById(param);
		}
		this.writeJSON("ok");
	}
	
	public void updTmplOrder() throws Exception {
		Map<String, Object> session = ActionContext.getContext().getSession();
    	UserInfoDto user = (UserInfoDto)session.get("user");
		if (StringUtils.isNotBlank(docId) && user!= null && user.getUser_id()>0) {
	    	// update
	    	Map<String, Object> param = new HashMap<String, Object>();
			param.put("order", order);
			param.put("tmpl_id", docId);
			param.put("update_by", user.getUser_id());
			tmplService.updateTmplDocById(param);
			this.writeJSON("ok");
		} else {
			this.writeJSON("ng");
		}
	}
	public void updTmplVip() throws Exception {
		Map<String, Object> session = ActionContext.getContext().getSession();
    	UserInfoDto user = (UserInfoDto)session.get("user");
		if (StringUtils.isNotBlank(docId) && user!= null && user.getUser_id()>0) {
	    	// update
	    	Map<String, Object> param = new HashMap<String, Object>();
			param.put("vip", vip);
			param.put("tmpl_id", docId);
			param.put("update_by", user.getUser_id());
			tmplService.updateTmplDocById(param);
			this.writeJSON("ok");
		} else {
			this.writeJSON("ng");
		}
	}
	
	public String getTmplType() throws Exception {
		if (StringUtils.isNotBlank(docId)) {
			tmplTypeInfo = tmplService.getTmplTypeIds(docId);
		}
		return SUCCESS;
	}
	
	public void updTmplType() throws Exception {
		if (StringUtils.isNotBlank(docId)) {
			tmplService.updateTmplTypeInfo(docId, typeIds);
		}
		this.writeJSON("ok");
	}
	
	public String getTypeForCombox() throws Exception {
		HttpServletRequest request = ServletActionContext.getRequest();
		String cat = request.getParameter("category");
		Map<String, Object> param = new HashMap<String, Object>();
		param.put("category", cat);
		tpyeComboList = tmplService.getDocTypeForCombo(param);
		
		return SUCCESS;
	}

	public String editTmplInit() {
		if (ServletActionContext.getRequest().getParameter("id") != null) {
			long docId = Long.valueOf(ServletActionContext.getRequest().getParameter("id"));
			//List<PageInfoDto> pagesInfo = this.tmplService.getPagesInfoById(docId);
		}
		return SUCCESS;
	}
	
	
	// 获取关键词信息
	public String getKeywordLst(){
		if(keywordList == null){
			keywordList = new ArrayList<Object>();
		}
		keywordList.clear();
		
		Map<String, Object> param = new HashMap<String, Object>();
		if(docId!=null && Long.valueOf(docId)>0){
			param.put("doc_id", docId);
		}
		List<KeywordInfoDto> kwList = tmplService.selectDocKeywordInfo(param);
		if(kwList != null && kwList.size()>0){
			Integer tmpType = kwList.get(0).getType();
			List<KeywordInfoDto> subList = new ArrayList<KeywordInfoDto>();
			
			// 按type分组
			for(int i=0; i<kwList.size(); i++){
				KeywordInfoDto info = kwList.get(i);
				
				if(info.getType() != tmpType){
					keywordList.add(subList);
					subList = new ArrayList<KeywordInfoDto>();
					
					tmpType = info.getType();
				}
				
				subList.add(info);
				
				if(i==kwList.size()-1){
					keywordList.add(subList);
				}
			}
		}

		return SUCCESS;
	}
	
	// 获取模版价格列表
	public String getTmplPriceInfoLst() throws Exception {
		// 用户信息
		Map<String, Object> session = ActionContext.getContext().getSession();
    	UserInfoDto user = (UserInfoDto)session.get("user");
    	if(user!=null && user.getUser_id()!=null && docId!=null && Long.valueOf(docId)>=0) {
    		HttpServletRequest request = ServletActionContext.getRequest();
    		String pageNumber = request.getParameter("page");
    		String pageSize = request.getParameter("rows");
    		Map<String, Object> param = new HashMap<String, Object>();
    		param.put("tmpl_id", docId);
    		
    		Page page = tmplService.pageQueryTmplPrice(param, Integer.parseInt(pageNumber),
    				Integer.parseInt(pageSize));
    		HashMap<String, Object> resMap = new HashMap<String, Object>();
    		resMap.put("total", page.getTotalCount());
    		resMap.put("rows", page.getResult());
    		//writeJSON(resMap);
    		mapResultTmplPrice = resMap;
    	} else {
    		mapResultTmplPrice.clear();
    	}

		return SUCCESS;
	}
	
	// 添加模版价格
	public void addTmplPrice() throws Exception {
		Map<String, Object> session = ActionContext.getContext().getSession();
    	UserInfoDto user = (UserInfoDto)session.get("user");
		if (tmplPriceInfo != null && user != null) {
			Map<String, Object> param = new HashMap<String, Object>();
    		param.put("update_by", user.getUser_id()+user.getUser_name());
    		param.put("tmpl_id", tmplPriceInfo.getTmpl_id());
    		param.put("type", tmplPriceInfo.getType());
    		param.put("price", tmplPriceInfo.getPrice());
    		param.put("period", tmplPriceInfo.getPeriod());
    		param.put("fee", 0);// 默认[不限免]
    		tmplService.insertTmplPrice(param);
    		this.writeJSON("ok");
		} else {
			this.writeJSON("ng");
		}
	}
	// 删除模版价格
	public void delTmplPrice() throws Exception {
		Map<String, Object> session = ActionContext.getContext().getSession();
    	UserInfoDto user = (UserInfoDto)session.get("user");
    	if(user!=null && user.getUser_id()!=null) {
    		Map<String, Object> param = new HashMap<String, Object>();
    		param.put("priceIds", StringUtils.listToString2(StringUtils.stringToList2(ids)));
			param.put("update_by", user.getUser_id()+user.getUser_name());
			tmplService.deleteTmplPriceInfo(param);
    		this.writeJSON("ok");
    	} else {
    		this.writeJSON("ng");
    	}
	}

	//get userdocInfo
	public String getPptTempUserdoc(){
		Map<String, Object> session = ActionContext.getContext().getSession();
		UserInfoDto user = (UserInfoDto)session.get("user");
		if(user!=null && user.getUser_id()!=null){
			HttpServletRequest request =ServletActionContext.getRequest();
			String pageNumber = request.getParameter("page");
    		String pageSize = request.getParameter("rows");
    		String tmplId = request.getParameter("tempId");
    		if(tmplId!=null){
    			Map<String, Object> parm = new HashMap<String, Object>();
    			if(StringUtils.isNotEmpty(findDocId)){
    				parm.put("doc_id",findDocId);
    			}
    			if(StringUtils.isNotEmpty(findUId)){
    				parm.put("user_id",findUId);
    			}
    			if(StringUtils.isNotEmpty(findMobile)){
    				parm.put("mobile",findMobile);
    			}
				parm.put("tmpl_id", tmplId);
				Page page=tmplService.getTmplUserDocInfo(parm, 
						Integer.parseInt(pageNumber),Integer.parseInt(pageSize));
				userDocMap.put("total",page.getTotalCount());
				userDocMap.put("rows",page.getResult());
    		}
    	}
		return SUCCESS;			
	}
	
	public TmplService getTmplService() {
		return tmplService;
	}

	public void setTmplService(TmplService tmplService) {
		this.tmplService = tmplService;
	}

	public List<TemplateInfoDto> getTmplDocList() {
		return tmplDocList;
	}

	public void setTmplDocList(List<TemplateInfoDto> tmplDocList) {
		this.tmplDocList = tmplDocList;
	}

	public TemplateInfoDto getTmplDocInfo() {
		return tmplDocInfo;
	}

	public void setTmplDocInfo(TemplateInfoDto tmplDocInfo) {
		this.tmplDocInfo = tmplDocInfo;
	}

	public String getIds() {
		return ids;
	}

	public void setIds(String ids) {
		this.ids = ids;
	}

	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	public String getFindTmplType() {
		return findTmplType;
	}

	public void setFindTmplType(String findTmplType) {
		this.findTmplType = findTmplType;
	}

	public String getFindPubFlg() {
		return findPubFlg;
	}

	public void setFindPubFlg(String findPubFlg) {
		this.findPubFlg = findPubFlg;
	}

	public String getFindTmplName() {
		return findTmplName;
	}

	public void setFindTmplName(String findTmplName) {
		this.findTmplName = findTmplName;
	}

	public String getFindMstFlg() {
		return findMstFlg;
	}

	public void setFindMstFlg(String findMstFlg) {
		this.findMstFlg = findMstFlg;
	}

	public HashMap<String, Object> getMapResult() {
		return mapResult;
	}

	public void setMapResult(HashMap<String, Object> mapResult) {
		this.mapResult = mapResult;
	}

	public String getDocId() {
		return docId;
	}

	public void setDocId(String docId) {
		this.docId = docId;
	}

	public String getTypeIds() {
		return typeIds;
	}

	public void setTypeIds(String typeIds) {
		this.typeIds = typeIds;
	}

	public List<String> getTmplTypeInfo() {
		return tmplTypeInfo;
	}

	public void setTmplTypeInfo(List<String> tmplTypeInfo) {
		this.tmplTypeInfo = tmplTypeInfo;
	}

	public List<DocTypeDto> getTpyeComboList() {
		return tpyeComboList;
	}

	public void setTpyeComboList(List<DocTypeDto> tpyeComboList) {
		this.tpyeComboList = tpyeComboList;
	}

	public String getEgretJsonInfo() {
		return egretJsonInfo;
	}

	public void setEgretJsonInfo(String egretJsonInfo) {
		this.egretJsonInfo = egretJsonInfo;
	}

	public String getOrder() {
		return order;
	}

	public void setOrder(String order) {
		this.order = order;
	}

	public List<TemplateInfoDto> getMstTmplList() {
		return mstTmplList;
	}

	public void setMstTmplList(List<TemplateInfoDto> mstTmplList) {
		this.mstTmplList = mstTmplList;
	}

	public List<TmplPageInfoDto> getMstTmplPageList() {
		return mstTmplPageList;
	}

	public void setMstTmplPageList(List<TmplPageInfoDto> mstTmplPageList) {
		this.mstTmplPageList = mstTmplPageList;
	}

	public List<Object> getKeywordList() {
		return keywordList;
	}

	public void setKeywordList(List<Object> keywordList) {
		this.keywordList = keywordList;
	}

	public HashMap<String, Object> getMapResultTmplPrice() {
		return mapResultTmplPrice;
	}

	public void setMapResultTmplPrice(HashMap<String, Object> mapResultTmplPrice) {
		this.mapResultTmplPrice = mapResultTmplPrice;
	}

	public TmplPriceInfoDto getTmplPriceInfo() {
		return tmplPriceInfo;
	}

	public void setTmplPriceInfo(TmplPriceInfoDto tmplPriceInfo) {
		this.tmplPriceInfo = tmplPriceInfo;
	}

	public String getFindTmplId() {
		return findTmplId;
	}

	public void setFindTmplId(String findTmplId) {
		this.findTmplId = findTmplId;
	}

	public String getFindUserId() {
		return findUserId;
	}

	public void setFindUserId(String findUserId) {
		this.findUserId = findUserId;
	}
	public String getVip() {
		return vip;
	}
	public void setVip(String vip) {
		this.vip = vip;
	}

	public HashMap<String, Object> getUserDocMap() {
		return userDocMap;
	}

	public void setUserDocMap(HashMap<String, Object> userDocMap) {
		this.userDocMap = userDocMap;
	}

	public String getFindDocId() {
		return findDocId;
	}

	public void setFindDocId(String findDocId) {
		this.findDocId = findDocId;
	}
	public String getFindMobile() {
		return findMobile;
	}
	public void setFindMobile(String findMobile) {
		this.findMobile = findMobile;
	}
	public static long getSerialversionuid() {
		return serialVersionUID;
	}
	public String getFindUId() {
		return findUId;
	}
	public void setFindUId(String findUId) {
		this.findUId = findUId;
	}
	
}
